<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ attribute name="url" type="java.lang.String" required="true" description="修改url"%>
<%@ attribute name="title" type="java.lang.String" required="true" description="内容title"%>
<%--<%@ attribute name="opt" type="java.lang.String" required="true" description="操作名称"%>--%>
<%@ attribute name="id" type="java.lang.String" required="true" description="id"%>
<%@ attribute name="func" type="java.lang.String" required="true" description="函数名称"%>
<%@ attribute name="width" type="java.lang.String" required="true" description="弹出框长度"%>
<%@ attribute name="height" type="java.lang.String" required="true" description="弹出框宽度"%>

<button class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="left" onclick="custom_${func}()" title="${title}"><i class="fa fa-file-text-o"></i> ${title}</button>


<script type="text/javascript">
    $(document).ready(function() {
        $('#contentTable thead tr th input.i-checks').on('ifChecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定
            $('#contentTable tbody tr td input.i-checks').iCheck('check');
        });

        $('#contentTable thead tr th input.i-checks').on('ifUnchecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定
            $('#contentTable tbody tr td input.i-checks').iCheck('uncheck');
        });

    });

    function custom_${func}(){

        var size = $("#contentTable tbody tr td input.i-checks:checked").size();
        if(size == 0 ){
            top.layer.alert('请至少选择一条数据!', {icon: 0, title:'警告'});
            return;
        }

        if(size > 1 ){
            top.layer.alert('只能选择一条数据!', {icon: 0, title:'警告'});
            return;
        }
        var id =  $("#contentTable tbody tr td input.i-checks:checkbox:checked").attr("id");

        openDialog('${title}',"${url}?id="+id,"800px", "500px","");
    }
</script><!-- 编辑按钮 -->
